import request from '@/utils/request'
import { genParam } from '@/utils/encrypt'

export function deleteImage(params) {
  const paramStr = genParam(params)

  return request({
    url: '/common/common/remove',
    method: 'post',
    data: paramStr
  })
}

export function getList(params) {
  console.log(params)
  genParam(params)

  return request({
    url: '/admin/integral2balance/list',
    method: 'get',
    params
  })
}

export function createIntegralProduct(param) {
  // console.log(param)
  const paramStr = genParam(param)
  // console.log(paramStr)

  return request({
    url: '/admin/integral2balance/create',
    method: 'post',
    data: paramStr
  })
}

export function editIntegralProduct(param) {
  const params = {
    stats: param.stats,
    name: param.name,
    icon: param.icon,
    price: param.price,
    exchange: param.exchange,
    type: param.type
  }
  const paramStr = genParam(params)
  console.log(paramStr)

  return request({
    url: '/admin/integral2balance/' + param.id + '/edit',
    method: 'put',
    data: paramStr
  })
}
